package com.example.novelsys.service;

import com.example.novelsys.dao.FavoritesDao;
import com.example.novelsys.entity.Favorites;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FavoriteService {
	@Autowired
	FavoritesDao favoritesDao;
	
	//根据用户id查询收藏的小说
	  public List<Favorites> queryByID(Long userId){
		  return favoritesDao.queryByID(userId);
	  }
	  
	//根据小说id删除收藏
	    public Integer deleteByKey(Integer favoriteId){
	    	return favoritesDao.deleteByKey(favoriteId);
	    }
	    
	    //添加收藏
	    public int addFavorites(Favorites   favorites) {
	    	return favoritesDao.addFavorites(favorites);
	    }

}
